﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Taurus.Components;
using System.Windows.Forms;
using Taurus.Garden.BLL;

namespace Taurus.Garden
{
    /// <summary>
    /// 花园
    /// </summary>
    class GardenComponent : Component
    {
        private UserControl _uc;

        public GardenComponent()
        {
            _uc = new Garden.UI.GardenUI(this);
        }

        public override string Name
        {
            get { return "菜地花园"; }
        }

        public override string Version
        {
            get { return "1.0.0.0"; }
        }

        public override string Unique
        {
            get { return "219CCF83-EFDC-4aa3-8C2C-78051E87F3A8"; }
        }

        public override System.Windows.Forms.UserControl GetUI()
        {
            return _uc;
        }

        protected override void Init()
        {
            InitSys.Instance.Init();
            foreach (var item in InitSys.Instance.GetMyGarden())
            {
                item.ReturnMessage += new EventHandler<ReturnMsgEventArgs>(item_ReturnMessage);
            }
        }

        void item_ReturnMessage(object sender, ReturnMsgEventArgs e)
        {
            if (e == null)
            {
                SendMessage(string.Empty);
            }
            else
            {
                SendMessage(e.Msg.Msg);
            }
        }

        
    }
}
